<?php

namespace Kanin\Games\lib;

class Config
{

    /**
     *
     * @param string $name
     * @param string $file
     * @return void
     */
    public static function get(string $name, string $file = "common")
    {
        $arr = explode('.', $name);
        $path = PATH_CFG . $file . '.php';
        if (!file_exists($path)) {
            return null;
        }
        $config = include PATH_CFG . $file . '.php';
        if (!empty($config)) {
            foreach ($arr as $item) {
                $config = $config[$item];
            }
        }
        return $config;
    }
}